let Activities = require('../model/Activities');
let printLog = require('../log4j-config');
module.exports = function (req, res) {
    //{ "title" : "test","time": "test","position" : "test","source" : "test"}
    Activities.create({
        title: req.body.title,
        time: req.body.time,
        position: req.body.position,
        source: req.body.source
    }).then(function (activity) {
        printLog.INFO(`INSERT an activity(aid = ${activity.aid}) at IP : ${req.host}`);
        res.status(200).send({succeed : true, aid : activity.aid});
    }).catch(function (err) {
        printLog.ERROR(`ERROR on INSERT an activity(aid = ${activity.aid}) at IP : ${req.host}`);
        res.status(500).send({succeed : false, err : error});
    });
}